package com.example.design.shejimoshi.structure.compose.组合模式链式任务;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description
 * @Author liuzhihui
 * @Date 2024/6/13
 */
public class TaskTest {

    public static void main(String[] args) {
        Task taskA = new CompositeTask("任务A");
        taskA.add(new LeafTask("A1"));
        taskA.add(new LeafTask("A2"));

        Task taskB = new CompositeTask("任务B");
        taskB.add(new LeafTask("B1"));
        taskB.add(new LeafTask("B2"));

        Task taskC = new CompositeTask("taskC");
        taskC.add(new LeafTask("C1"));
        taskC.add(new LeafTask("C2"));

        taskA.add(taskB);
        taskB.add(taskC);


        taskA.execute();
    }
}
